(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 7.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[      5716,        162]
NotebookOptionsPosition[      5387,        146]
NotebookOutlinePosition[      5733,        161]
CellTagsIndexPosition[      5690,        158]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell[BoxData[{
 RowBox[{
  RowBox[{"stream", " ", "=", " ", 
   RowBox[{
   "OpenRead", "[", 
    "\"\<E:\\\\_Long\\\\Work\\\\Programming\\\\Project \
Euler\\\\18\\\\18.txt\>\"", "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"n", " ", "=", " ", "15"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"Array", "[", 
   RowBox[{"a", ",", " ", 
    RowBox[{"{", 
     RowBox[{"n", ",", " ", "n"}], "}"}]}], "]"}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"For", " ", "[", 
   RowBox[{
    RowBox[{"i", "=", "1"}], ",", " ", 
    RowBox[{"i", " ", "\[LessEqual]", "  ", "n"}], ",", " ", 
    RowBox[{"i", "++"}], ",", " ", "\[IndentingNewLine]", "\t", 
    RowBox[{
     RowBox[{"For", " ", "[", 
      RowBox[{
       RowBox[{"j", "=", "1"}], ",", " ", 
       RowBox[{"j", "  ", "\[LessEqual]", " ", "i"}], ",", " ", 
       RowBox[{"j", "++"}], ",", " ", "\[IndentingNewLine]", "\t\t", 
       RowBox[{
        RowBox[{
         RowBox[{"a", "[", "i", "]"}], "[", "j", "]"}], " ", "=", " ", 
        RowBox[{"Read", "[", 
         RowBox[{"stream", ",", " ", "Number"}], " ", "]"}]}]}], 
      "\[IndentingNewLine]", "\t", "]"}], ";"}]}], "\[IndentingNewLine]", 
   "]"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"Close", "[", "stream", "]"}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{
   RowBox[{"Array", "[", 
    RowBox[{"d", ",", " ", 
     RowBox[{"{", 
      RowBox[{"n", ",", " ", "n"}], "}"}], ",", " ", 
     RowBox[{"{", 
      RowBox[{"0", ",", " ", "0"}], "}"}]}], "]"}], ";"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"For", "[", 
   RowBox[{
    RowBox[{"i", "=", "0"}], ",", " ", 
    RowBox[{"i", " ", "\[LessEqual]", " ", "n"}], ",", " ", 
    RowBox[{"i", "++"}], ",", " ", "\[IndentingNewLine]", "\t", 
    RowBox[{"For", "[", 
     RowBox[{
      RowBox[{"j", "=", "0"}], ",", " ", 
      RowBox[{"j", " ", "\[LessEqual]", " ", "n"}], ",", " ", 
      RowBox[{"j", "++"}], ",", 
      RowBox[{
       RowBox[{
        RowBox[{"d", "[", "i", "]"}], "[", "j", "]"}], " ", "=", " ", "0"}]}],
      "\[IndentingNewLine]", "\t", "]"}]}], "\[IndentingNewLine]", "]"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"For", " ", "[", 
   RowBox[{
    RowBox[{"i", "=", "1"}], ",", " ", 
    RowBox[{"i", " ", "\[LessEqual]", "  ", "n"}], ",", " ", 
    RowBox[{"i", "++"}], ",", " ", "\[IndentingNewLine]", "\t", 
    RowBox[{"For", " ", "[", 
     RowBox[{
      RowBox[{"j", "=", "1"}], ",", " ", 
      RowBox[{"j", " ", "\[LessEqual]", "  ", "i"}], ",", " ", 
      RowBox[{"j", "++"}], ",", " ", 
      RowBox[{
       RowBox[{
        RowBox[{"d", "[", "i", "]"}], "[", "j", "]"}], " ", "=", " ", 
       RowBox[{
        RowBox[{"Max", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"d", "[", 
            RowBox[{"i", "-", "1"}], "]"}], "[", "j", "]"}], ",", " ", 
          RowBox[{
           RowBox[{"d", "[", 
            RowBox[{"i", "-", "1"}], "]"}], "[", 
           RowBox[{"j", "-", "1"}], "]"}]}], "]"}], " ", "+", " ", 
        RowBox[{
         RowBox[{"a", "[", "i", "]"}], "[", "j", "]"}]}]}]}], 
     "\[IndentingNewLine]", "\t", "]"}]}], "\[IndentingNewLine]", "]"}], 
  "\[IndentingNewLine]"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"max", " ", "=", " ", 
   RowBox[{"-", "\[Infinity]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{"For", "[", 
  RowBox[{
   RowBox[{"i", " ", "=", "1"}], ",", " ", 
   RowBox[{"i", " ", "\[LessEqual]", " ", "n"}], ",", " ", 
   RowBox[{"i", "++"}], ",", " ", 
   RowBox[{"max", " ", "=", " ", 
    RowBox[{"Max", "[", 
     RowBox[{"max", ",", " ", 
      RowBox[{
       RowBox[{"d", "[", "n", "]"}], "[", "i", "]"}]}], "]"}]}]}], 
  "]"}], "\[IndentingNewLine]", 
 RowBox[{"Print", "[", "max", "]"}]}], "Input",
 CellChangeTimes->{{3.447614639241*^9, 3.447614663112*^9}, {3.447614759651*^9,
    3.447614921795*^9}, {3.447618327016*^9, 3.447618340025*^9}, {
   3.4476183814049997`*^9, 3.447618388407*^9}, 3.44761851304*^9, 
   3.447619341441*^9, 3.447619398974*^9, {3.447619430027*^9, 
   3.447619431322*^9}, {3.447619528935*^9, 3.447619538933*^9}, {
   3.447619593234*^9, 3.447619719513*^9}, {3.447619769689*^9, 
   3.447619773752*^9}, {3.447619884196*^9, 3.447619930112*^9}, {
   3.4476199867*^9, 3.4476200376070004`*^9}, {3.44762012151*^9, 
   3.447620310347*^9}, {3.447620779519*^9, 3.447620844014*^9}, {
   3.4476208752130003`*^9, 3.447620876876*^9}, {3.4476209335769997`*^9, 
   3.4476209572349997`*^9}, {3.44762371905*^9, 3.447623794226*^9}, {
   3.4476238353310003`*^9, 3.447623836035*^9}}],

Cell[BoxData["1074"], "Print",
 CellChangeTimes->{{3.44762028934*^9, 3.4476203154189997`*^9}, 
   3.447620849514*^9, 3.4476238033780003`*^9, 3.447623856191*^9}]
}, Open  ]]
},
WindowSize->{990, 750},
WindowMargins->{{187, Automatic}, {Automatic, 25}},
FrontEndVersion->"7.0 for Microsoft Windows (32-bit) (November 10, 2008)",
StyleDefinitions->"Default.nb"
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[567, 22, 4641, 117, 512, "Input"],
Cell[5211, 141, 160, 2, 23, "Print"]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
